package service;

import mapper.BusinessTotalMapper;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import pojo.BusinessTotal;
import util.SqlSessionFactoryUtil;

import java.util.List;

public class BusinessTotalService {
    private final SqlSessionFactory sqlSessionFactory = SqlSessionFactoryUtil.getSqlSessionFactory();

    /**
     * 查询所有售票记录
     * @return
     */
    public List<BusinessTotal> selectAll() {
        SqlSession sqlSession = sqlSessionFactory.openSession();
        BusinessTotalMapper mapper = sqlSession.getMapper(BusinessTotalMapper.class);

        List<BusinessTotal> businessTotals = mapper.selectAll();

        sqlSession.close();
        return businessTotals;
    }
}
